<%@ Assembly Name="zevenseas.LifeCycleManagement.ApplicationPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4306074270f0265a" %>
<%@ Page Language="C#" Inherits="zevenseas.LifeCycleManagement.ApplicationPages.OverviewSites" MasterPageFile="~/_admin/admin.master"%> 

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 

<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.Administration" %>
<%@ Import Namespace="System.Data" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" src="~/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="~/_controltemplates/ToolBarButton.ascx" %>
<%@ Register TagPrefix="LCM" Namespace="zevenseas.LifeCycleManagement.Utilities" Assembly="zevenseas.LifeCycleManagement.Utilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4306074270f0265a" %>
<asp:Content ID="Content1" contentplaceholderid="PlaceHolderPageTitle" runat="server">

	<SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="Overview of unused sites" EncodeMethod='HtmlEncode'/>
</asp:content>
<asp:Content ID="Content2" contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">
	<SharePoint:EncodedLiteral ID="EncodedLiteral2" runat="server" text="Overview of unused sites" EncodeMethod='HtmlEncode'/>
</asp:Content>
<asp:content ID="Content3" contentplaceholderid="PlaceHolderPageDescription" runat="server">
</asp:content>
<asp:content ID="Content4" contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript">
    function Visascii(ch) {
        return (!(ch.charCodeAt(0) & 0x80));
    }
    function Visspace(ch) {
        return (ch.charCodeAt(0) == 32) || ((9 <= ch.charCodeAt(0)) && (ch.charCodeAt(0) <= 13));
    }
    function stripWS(str) {
        var b = 0;
        var e = str.length;
        while (str.charAt(b) && (Visascii(str.charAt(b)) && Visspace(str.charAt(b))))
            b++;
        while ((b < e) && (Visascii(str.charAt(e - 1)) && Visspace(str.charAt(e - 1))))
            e--;
        return ((b >= e) ? "" : str.substring(b, e));
    }
    var L_NoFieldEmpty_TEXT = "<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,common_nofieldempty_TEXT%>' EncodeMethod='EcmaScriptStringLiteralEncode'/>";
    function CheckForEmptyField(text_orig, field_name) {
        var text = stripWS(text_orig);
        if (text.length == 0) {
            alert(StBuildParam(L_NoFieldEmpty_TEXT, field_name));
            return false;
        }
        return (true);
    }
    function CheckForEmptyFieldNoAlert(text_orig) {
        var text = stripWS(text_orig);
        if (text.length == 0) {
            return false;
        }
        return (true);
    }
    var L_WrongEmailName_TEXT = "<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,common_wrongemailname_TEXT%>' EncodeMethod='EcmaScriptStringLiteralEncode'/>";
    function CheckForAtSighInEmailName(text_orig, field_name) {
        var text = stripWS(text_orig);
        if (!CheckForEmptyField(text_orig, field_name)) return false;
        var indexAt = 0;
        var countAt = 0;
        var countSpace = 0;
        var len = text.length;
        while (len--) {
            if (text.charAt(len) == '@') {
                indexAt = len;
                countAt++;
            }
            if (text.charAt(len) == ' ')
                countSpace++;
        }
        if ((countAt == 0) ||
		(indexAt == 0) ||
		(indexAt == (text.length - 1))
		) {
            alert(StBuildParam(L_WrongEmailName_TEXT, field_name));
            return false;
        }
        if (countSpace != 0) {
            alert(L_TextWithoutSpaces1_TEXT + field_name);
            return false;
        }
        return (true);
    }
    var checkBoxGroupName = "siteCheckboxes";
    function checkBoxClick() {
        var checkBoxHidden = (document.getElementById("<%= HiddenSiteSelections.ClientID %>"));
        checkBoxHidden.value = "";
        var selectAllCheckBox = document.getElementById("selectAllCheckBox");
        if (selectAllCheckBox != null)
            selectAllCheckBox.checked = false;
        var i;
        for (i = 0; i < theForm.length; i++) {
            curGroup = theForm[i].group;
            if (checkBoxGroupName == curGroup && theForm[i].checked == true)
                checkBoxHidden.value += theForm[i].name + "#";
        }
    }
    function selectAllCheckBoxClick(selectAllCheckBox) {
        var newCheckBoxState = selectAllCheckBox.checked;
        for (i = 0; i < theForm.length; i++) {
            curGroup = theForm[i].group;
            if (checkBoxGroupName == curGroup)
                theForm[i].checked = newCheckBoxState;
        }
        checkBoxClick();
        selectAllCheckBox.checked = newCheckBoxState;
    }
    function _spBodyOnLoad() {
        var checkBoxHidden = (document.getElementById("<%= HiddenSiteSelections.ClientID %>"));
        checkBoxHidden.value = "";
    }
</script>
</asp:content>
<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderMain" runat="server">
	<input type="hidden" id="HiddenSiteSelections" runat="server" />
	</tr>
	<tr>
			<td nowrap="" class="ms-linksectionheader" style="padding: 4px;" width="100%">
			  <asp:Literal id="Timerjobstatus" runat="server" Text="Timer Job Status" />
			</td>
	</tr>
	<tr>
	<tr>
			<td nowrap="" class="ms-pageinformation" style="padding: 4px;" width="100%">
			    <asp:Table id="objectStatusTable" Visible="true" runat="server" width="100%" style="font-size: 10pt;">
					<asp:TableRow id="objectStatusRow" runat="server">
						<asp:TableCell>
							    <asp:Label id="JobStatus" runat="server" />
						</asp:TableCell>
						<asp:TableCell>
							<IMG SRC="/_layouts/images/blank.gif" width="1" height="1" alt="">
						</asp:TableCell>
					</asp:TableRow>
				</asp:Table>
			</td>
		</tr>

	</tr>
	<tr>
			<td nowrap="" class="ms-linksectionheader" style="padding: 4px;" width="100%">
			  <asp:Literal id="Overview" runat="server" Text="Overview" />
			</td>
	</tr>
	<tr>
	<wssuc:ToolBar id="Toolbar" runat="server" CssClass="ms-toolbar">
		<template_buttons>
		    <wssuc:ToolBarButton ID="uxRefreshLink" runat="server" Text="Refresh the page" OnClick="RefreshStatsClick" />
			<wssuc:ToolBarButton runat="server"
				id="Mail"
				Text="Mail"
				ToolTip=""
				OnClick="MailLink"
				ImageUrl="/_layouts/images/newitem.gif"
				Padding="2px"
				AccessKey="M" />
			<wssuc:ToolBarButton runat="server"
				id="Lock"
				Text="Lock"
				ToolTip=""
				OnClick="LockLink"
				ImageUrl="/_layouts/images/newitem.gif"
				Padding="2px"
				AccessKey="L" />
			<wssuc:ToolBarButton runat="server"
				id="Delete"
				Text="Delete"
				ToolTip=""
		        OnClick="DeleteLink"
				ImageUrl="/_layouts/images/newitem.gif"
				Padding="2px"
				AccessKey="D" />
		    <wssuc:ToolBarButton runat="server"
				id="Gather"
				Text="Gather"
				ToolTip=""
		        OnClick="GatherLink"
				ImageUrl="/_layouts/images/newjob.gif"
				Padding="2px"
				AccessKey="G" />
		    <wssuc:ToolBarButton runat="server"
				id="Action"
				Text="Action"
				ToolTip=""
		        OnClick="ActionLink"
				ImageUrl="/_layouts/images/newjob.gif"
				Padding="2px"
				AccessKey="A" />
		</template_buttons>
		<template_rightbuttons>
			<SharePoint:WebApplicationSelector id="Selector" runat="server"
				
				TypeLabelCssClass="ms-listheaderlabel" />
		</template_rightbuttons>
	</wssuc:ToolBar>
	  <wssuc:ToolBar runat="server" id="ToolBarLow" CssClass="ms-toolbar">
	<Template_Buttons>
		<asp:Panel runat="server" DefaultButton="SearchButton">
		   <SharePoint:EncodedLiteral ID="EncodedLiteral3" runat="server" text="Search" EncodeMethod='HtmlEncode'/>
		   <wssawc:InputFormTextBox Title="Search" class="ms-input" ID="TxtUrlSearch" Columns="35" Runat="server" AutoPostBack="false" AccessKey="S" />
		   <asp:ImageButton id="SearchButton" runat="server"
			   AlternateText="Search"
			   ImageAlign="AbsMiddle"
			   ImageUrl="/_layouts/images/gosearch.gif"
			   OnClick="SearchLinkClick"
			    />
	   </asp:Panel>
	</Template_Buttons>
	<Template_RightButtons>
		<SharePoint:SPGridViewPager ID="gridViewPager" GridViewId="gridView" runat="server" EnableViewState="false" />		
	</Template_RightButtons>
  </wssuc:ToolBar>
  
    <SharePoint:MenuTemplate ID="UserMenu" runat="server">
        <SharePoint:MenuItemTemplate ID="MenuItemTemplate1" 
            runat="server" 
            Text="View this web" 
            ImageUrl="/_layouts/images/EDITITEM.GIF" 
            ClientOnClickNavigateUrl="/_admin/LCM/OverViewWebs.aspx?SiteId=%SITEID%&WebAppId=%WEBAPPID%"            
            Title="Edit">
        </SharePoint:MenuItemTemplate>    
    </SharePoint:MenuTemplate>
  
	<SharePoint:SPGridView ID="gridView" runat="server" 
	    AutoGenerateColumns="false" 
	    Width="100%" 
	    AllowPaging="true" 
	    AllowSorting="true"
	    AllowFiltering="true"
	    FilterDataFields = "Url,Title,Url,Status,LastUsageDate,Web,Size,OwnerEmailAddress,Mailed,MailedAt, Locked, LockedAt, Deleted, DeletedAt"
	    
	    FilteredDataSourcePropertyFormat = "{1} LIKE '{0}'"
	    PageSize="50" 
	    DataSourceId="objectDataSource">
		<AlternatingRowStyle CssClass="ms-alternating" />
		<Columns>
			<asp:BoundField DataField="Url" DataFormatString='<input type="checkbox" group="siteCheckboxes" name="{0}" onclick="checkBoxClick();">' HtmlEncode="false" ItemStyle-Width="1"/>
			<SharePoint:SPMenuField 
                HeaderText="Title" 
                TextFields="Title"
                MenuTemplateId="UserMenu"
                NavigateUrlFields="SiteGuid,WebApplication" 
                NavigateUrlFormat="/_admin/LCM/OverViewWebs.aspx?SiteId={0}&WebAppId={1}" 
                TokenNameAndValueFields="SITEID=SiteGuid,WEBAPPID=WebApplication"
                SortExpression="Title" />	
            <asp:hyperlinkfield datatextfield="Url"  datanavigateurlfields="Url" headertext="Link" />
			<SharePoint:SPBoundField DataField="Status"  HeaderText="Status" HeaderStyle-Font-Bold="true" />
			<LCM:SPBoundDateTimeField DataField="LastUsageDate"  HeaderText="Last Usage" HeaderStyle-Font-Bold="true" />
			<SharePoint:SPBoundField DataField="Web"  HeaderText="Webs" HeaderStyle-Font-Bold="true" />
			<SharePoint:SPBoundField DataField="UnusedWebs"  HeaderText="Unused Webs" HeaderStyle-Font-Bold="true" />
            <SharePoint:SPBoundField DataField="Size"  HeaderText="Size" HeaderStyle-Font-Bold="true" />
			
			<SharePoint:SPBoundField DataField="OwnerEmailAddress"  HeaderText="Owners" HeaderStyle-Font-Bold="true" />
            <LCM:SPBoundBooleanField DataField="Mailed" HeaderText="Mailed" HeaderStyle-Font-Bold="true" />			
			<LCM:SPBoundDateTimeField DataField="MailedAt" HeaderText="Mailed At" HeaderStyle-Font-Bold="true" />
			
			<LCM:SPBoundBooleanField DataField="Locked" HeaderText="Locked" HeaderStyle-Font-Bold="true" />			
			<LCM:SPBoundDateTimeField DataField="LockedAt" HeaderText="Locked At" HeaderStyle-Font-Bold="true" />
			
			<LCM:SPBoundBooleanField DataField="Deleted" HeaderText="Deleted" HeaderStyle-Font-Bold="true" />			
			<LCM:SPBoundDateTimeField DataField="DeletedAt" HeaderText="Deleted At" HeaderStyle-Font-Bold="true" />
			
		</Columns>
	</SharePoint:SPGridView>
	<asp:ObjectDataSource ID="objectDataSource" runat="server" 
	    SelectMethod="GetSites"
	    TypeName="zevenseas.LifeCycleManagement.ApplicationPages.OverviewSites,zevenseas.LifeCycleManagement.ApplicationPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4306074270f0265a"  
	    EnableCaching="false"
	    FilterExpression="WebApplication LIKE '%{0}%'">
        	<FilterParameters>
	            <asp:ControlParameter
        	        Name="Status"
                	ControlID="ctl00$PlaceHolderMain$Toolbar$RightRptControls$Selector"
			propertyname="CurrentItem.Name"/>                 		   
        	</FilterParameters>    
	</asp:ObjectDataSource> 
</asp:Content>  
